/*
 *	testone.m
 *
 *	David Janes
 *	Discover Anywhere Mobile
 *	March 2010
 *
 *	Copyright 2010 Discover Anywhere Mobile
 *
 *	Purpose:
 *	feed JSON data to a Djolt template and see what comes out
 */

#import <Foundation/Foundation.h>
#import "DjoltTemplate.h"

main(int ac, char** av)
{
	id pool = [[NSAutoreleasePool alloc] init];  
	int ai;

	for (ai = 1; ai < ac; ai++) {
		NSString* file_json = [[NSString alloc] initWithFormat:@"%s.json", av[ai]];
		NSString* file_djolt = [[NSString alloc] initWithFormat:@"%s.djolt", av[ai]];

		NSData* ddata = [NSData dataWithContentsOfFile:file_json];
		NSDictionary* d = [NSJSONSerialization JSONObjectWithData:ddata options:0 error:nil];

		DjoltTemplate* t = [[DjoltTemplate alloc] initWithTemplateFile:file_djolt];
		NSString* r = [t render:d];

		NSLog(@"result:\n\n%@\n\n", r);
	}

	[pool release];
}


